package org.duang.db.sql.parser.decode;

import java.lang.reflect.Field;
import java.util.Map;

import org.duang.db.IdEntity;

public abstract class SqlDecoder {
	
	public final static String ID_FIELD = "id";
	
	protected Field field;
	protected Map<String, Object> map;
	protected Object value;
	
	public SqlDecoder(Map<String, Object> map, Field field) {
		this.map = map;
		this.field = field;
		this.value = field.getName().equals(ID_FIELD) ? map.get(IdEntity.ID_FIELD) : map.get(field.getName());
	}
	
	public Field getField() {
		return field;
	}
	
	public abstract String getFieldName();
    
    public abstract Object getFieldValue();
	
    public abstract boolean isNullField();
    
    public abstract void setObj(Object obj);
}
